﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ProxyHero.HttpUility
{
    public class UpdateHelper
    {
        public string NewVersion = "";
        public string LocalVersion = "";

        public UpdateHelper()
        {}

        public bool CheckVersion()
        {
            bool needUpdate = false;
            this.NewVersion = Config.NewVersion;
            this.LocalVersion = Application.ProductVersion;

            double dbNewVersion = double.Parse(this.NewVersion.Replace(".", ""));
            double dbLocalVersion = double.Parse(this.LocalVersion.Replace(".", ""));

            if (dbNewVersion > dbLocalVersion)
            {
                needUpdate = true;
            }
            else
            {
                needUpdate = false;
            }

            return needUpdate;
        }
    }
}
